<div class="panel panel-default panel-intro">
    <div class="panel-heading">
        <h3 class="panel-title">员工工作负荷统计</h3>
    </div>
    <div class="panel-body">
        <div class="row">
            <div class="col-md-12">
                <div class="box">
                    <div class="box-header with-border">
                        <h3 class="box-title">工作负荷概览</h3>
                    </div>
                    <div class="box-body">
                        <div class="table-responsive">
                            <table id="workload-table" class="table table-striped table-bordered table-hover">
                                <thead>
                                    <tr>
                                        <th>员工姓名</th>
                                        <th>岗位</th>
                                        <th>技能等级</th>
                                        <th>当前分配任务数</th>
                                        <th>已完成任务数</th>
                                        <th>待完成任务数</th>
                                        <th>工作负荷率</th>
                                        <th>最后报工时间</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    {foreach $workloadList as $item}
                                    <tr>
                                        <td>{$item.employee_name}</td>
                                        <td>{$item.position}</td>
                                        <td>
                                            {switch name="item.skill_level"}
                                                {case value="basic"}基础{/case}
                                                {case value="intermediate"}中级{/case}
                                                {case value="advanced"}高级{/case}
                                                {default /}{$item.skill_level}
                                            {/switch}
                                        </td>
                                        <td>{$item.total_allocations}</td>
                                        <td>{$item.completed_allocations}</td>
                                        <td>{$item.pending_allocations}</td>
                                        <td>
                                            {php}
                                                $rate = $item['total_allocations'] > 0 ? round(($item['completed_allocations'] / $item['total_allocations']) * 100, 1) : 0;
                                                $class = $rate >= 80 ? 'label-success' : ($rate >= 60 ? 'label-warning' : 'label-danger');
                                            {/php}
                                            <span class="label {$class}">{$rate}%</span>
                                        </td>
                                        <td>
                                            {if $item.last_report_time}
                                                {$item.last_report_time|date='Y-m-d H:i:s',###}
                                            {else}
                                                <span class="text-muted">暂无</span>
                                            {/if}
                                        </td>
                                    </tr>
                                    {/foreach}
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        
        <div class="row">
            <div class="col-md-6">
                <div class="box">
                    <div class="box-header with-border">
                        <h3 class="box-title">工作负荷分布</h3>
                    </div>
                    <div class="box-body">
                        <div class="info-box">
                            <span class="info-box-icon bg-green"><i class="fa fa-check"></i></span>
                            <div class="info-box-content">
                                <span class="info-box-text">负荷正常员工</span>
                                <span class="info-box-number">{$normalCount}</span>
                            </div>
                        </div>
                        <div class="info-box">
                            <span class="info-box-icon bg-yellow"><i class="fa fa-warning"></i></span>
                            <div class="info-box-content">
                                <span class="info-box-text">负荷较高员工</span>
                                <span class="info-box-number">{$highCount}</span>
                            </div>
                        </div>
                        <div class="info-box">
                            <span class="info-box-icon bg-red"><i class="fa fa-exclamation"></i></span>
                            <div class="info-box-content">
                                <span class="info-box-text">负荷过重员工</span>
                                <span class="info-box-number">{$overloadCount}</span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-md-6">
                <div class="box">
                    <div class="box-header with-border">
                        <h3 class="box-title">技能等级分布</h3>
                    </div>
                    <div class="box-body">
                        <div class="progress-group">
                            <span class="progress-text">基础员工</span>
                            <span class="float-right"><b>{$skillStats.basic}</b>人</span>
                            <div class="progress progress-sm">
                                <div class="progress-bar bg-blue" style="width: {$skillStats.basic_percent}%"></div>
                            </div>
                        </div>
                        <div class="progress-group">
                            <span class="progress-text">中级员工</span>
                            <span class="float-right"><b>{$skillStats.intermediate}</b>人</span>
                            <div class="progress progress-sm">
                                <div class="progress-bar bg-green" style="width: {$skillStats.intermediate_percent}%"></div>
                            </div>
                        </div>
                        <div class="progress-group">
                            <span class="progress-text">高级员工</span>
                            <span class="float-right"><b>{$skillStats.advanced}</b>人</span>
                            <div class="progress progress-sm">
                                <div class="progress-bar bg-yellow" style="width: {$skillStats.advanced_percent}%"></div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
